/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JP_Utiles_Archivo.java
 *
 * Created on 02/11/2009, 09:17:06 AM
 */

package helper;

import java.io.File;
import javax.swing.JFrame;

/**
 *
 * 
 */
public class JP_Utiles_Archivo extends JP_Utiles_PanelModelo {

    /** Creates new form JP_Utiles_Archivo */
    public JP_Utiles_Archivo() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTabla = new javax.swing.JTable();

        setName("Form"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jTabla.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jTabla.setName("jTabla"); // NOI18N
        jScrollPane1.setViewportView(jTabla);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(15, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(14, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    public void mostrarArchivos( String ruta ){
        File fichero  =  new File( ruta );
        //FileNameExtensionFilter filter = new FileNameExtensionFilter("TXT & DBF", "txt", "dbf");        
        String[] listaArchivos = fichero.list( new Filtro(".DBF")  );
        for(int i=0; i<listaArchivos.length; i++){
            System.out.println(listaArchivos[i]);
        }        
    }

    public static void main( String [] args ){
        try {
            //Utiles_Archivo.copiarArchivo("", "", "");
//            Date d = new Date();
//            System.out.println( "getHours" + d.getHours());
//            System.out.println( "getHours" + d.getMinutes());
//            System.out.println( "getHours" + d.getSeconds());
//            System.out.println( "getHours" + d.getTime());
            JP_Utiles_Archivo panel = new JP_Utiles_Archivo();
            JFrame ventana = Utiles_Panel.creaVentana(panel, "Prueba archivo");
            panel.mostrarArchivos( "S:/APLICA/Cobranza/Dbf/" );

        } catch (Exception ex) {
            System.out.println( "Error: " + ex.getMessage() );
        }
    }

    String ruta = null;

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTabla;
    // End of variables declaration//GEN-END:variables

}
